package inheritancedemo;

class Animal {
    public String name;
    public int age;
    public String sex;

    public void eat() {
        System.out.println(this.name + "eat()!");
    }

    public void sleep() {
        System.out.println(this.name + "sleep()!");
    }
}

class Cat extends Animal {

    public void mew() {
        System.out.println(this.name + "cat::mew()!");
    }
}

class Dog extends Animal {

    public void bark() {
        System.out.println(this.name + "dog::bark()!");
    }
}

public class TestDemo {

    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.name = "咪咪";
        cat.age = 6;
        cat.sex = "女";
        cat.sleep();
        cat.mew();
        cat.eat();
    }
}
